package main

import (
	"climit/climit"
	"fmt"
)

func main() {
	rootCommand := climit.RootCommand{
		Description: "这是一个测试命令",
		Options: []climit.Option{
			climit.BoolOption{
				ShortName:   "l",
				LongName:    "list",
				Description: "是否列出参数",
			},
		},
		Run: func(commandDescriptor climit.CommandDescriptor) {
			arguments := commandDescriptor.GetArguments()
			fmt.Println("输入参数数量为: ", len(arguments))
			if commandDescriptor.GetBoolOptionValue("l") {
				for idx, arg := range arguments {
					fmt.Println(idx, ":", arg)
				}
			} else {
				for _, arg := range arguments {
					fmt.Printf("%s ", arg)
				}
			}
			fmt.Println()
		},
	}
	rootCommand.Execute()
}
